<template>
	<view>
		<!-- <f-navbar v-model:title="title" /> -->
		<install-home ref="installHomes" v-if="tabberIndex == 0" />
		<install-me v-if="tabberIndex == 2" />
		<f-tabber />
	</view>
</template>

<script setup>
	import installHome from './components/home/index.vue';
	import installMe from './components/me/index.vue';
	import { getCurrentInstance, reactive, ref, onMounted, computed } from 'vue';
	import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
	import { useStore } from 'vuex';
	const { state, commit, dispatch } = useStore();
	const { proxy } = getCurrentInstance();

	// 给底部导航栏赋值
	let tabberIndexDefault = ref(0);
	onLoad(options => {
		uni.hideHomeButton(); // 隐藏小房子
		commit('tabber/changeTabberIndex', tabberIndexDefault.value); // 给导航栏下标赋值
		dispatch('tabber/tabberSupervise'); // 监督端
	});
	let tabberIndex = computed(() => {
		return state.tabber.tabberIndex;
	});
	// 给标题类赋值
	let title = ref('华安智慧物联设备平台');
	// 计算导航栏的高度
	let tabberStyle = computed(() => {
		return `top:${proxy.customBar}px;`;
	});
	// 上拉加载
	let installHomes = ref(null);
	onReachBottom(() => {
		if (tabberIndex.value == 0) {
			installHomes.value.onReachBottomMethods();
		}
	});
	// 下拉刷新
	onPullDownRefresh(() => {
		console.log('下拉刷新');
	});
</script>

<style scoped lang="scss"></style>